DZApp.service(
				'changeOrderLogService',
				function(commonService) {
					return {
						query : function(postData) {
							var url = "/operationService/queryChangeOrderLog";
							return commonService
									.commonAjaxByPost(url, postData);
						},
						validate : function($scope) {
							return true;
						}
					};
				});
DZApp.controller('changeOrderLogController', function($scope, changeOrderLogService,
		$state) {
	$scope.orderSearchModel = {};
	$scope.orderItemlist = {};
	$scope.queryMainSeviceSelect = {};
	$scope.query = {};
	$scope.isNeedConditionValidate = false;
	 $scope.myObj = {
		        "background-color" : "red"
		    }
	 $scope.getStyle=function(index,type ){
		 var style={
				 "font-size": "14px",
				 "font-weight": "600", 
				 "border": "none"
		 }
		 if(type=="item"){
			 if(index==-1){
				 style["background-color"] = "#9595f5";  
				 return style;
			 }
			 if(0==index%2){
				 return {"background-color":"#9999fb"};
			 }else {
				 return {"background-color" : "#9595f5"};
			 }
		 }
		 if(type=="info"){
			 if(index==-1){
				 style["background-color"] = "#8fddd4";  
				 return style;
			 }
			 if(0==index%2){
				 return {"background-color" : "#92e2d9"};
			 }else {
				 return {"background-color" : "#8fddd4"};
			 }
		 }
		 if(type=="detail"){
			 if(index==-1){
				 style["background-color"] = "#00aede";  
				 return style;
			 }
			 if(0==index%2){
				 return {"background-color" : "#00b2e3"};
			 }else {
				 return {"background-color" : "#00aede"};
			 }
		 }
	 };
	 
	var pagation ={
			prePageNum:20,
			curPageNo:1,
			curPageNo:1,
			param:null
	};
	// 翻页出发分析
	$scope.onPageChange = function() {
		var item;
		var itemtr
		for(index in $scope.orderItemlist){
			item=$scope.orderItemlist[index];
			itemtr=$("#"+item.orderNo+"");
			if(itemtr!=null){
				itemtr.remove();
			}
		}
		pagation.curPageNo = $scope.currentPage;
		queryPagination($.param(pagation));
	};
	// 分页回调函数
	var doResponseCallback = function(data) {
		if ("success" == data.retCode) {
			var data  = eval(data.bizData);
			$scope.query = data.list;
			$scope.orderItemlist = data.orderItemlist;
			$scope.pageCount = data.totalPage;
		} else {
			bootboxWindow.alert('警告查询错误:' + data.errorMsg, null);
		}
	};
	// 參數封裝
	var doParam = function(){
//		var param ={
//				queryType:null,
//				queryValue:null
//		};
//		param.queryType="3";
//		param.queryValue="18010511232";
//		pagation.param = JSON.stringify(param);
		pagation.param = JSON.stringify($scope.orderSearchModel);
//		pagation.param = JSON.stringify($scope.orderSearchModel);
		return $.param(pagation);
	}
	// 分页查询
	var queryPagination = function(param){
		$scope.query = null;
		
		changeOrderLogService.query(param).then(doResponseCallback);
	}
	
	// 是否初始化的就查询
	var isQueryInit = true;
	if (isQueryInit) {
		queryPagination(doParam());
	}
	// 查詢
	$scope.queryOrderResport = function() {
//		// 校验
//		if (!bValidateObj.bValidateCall($('#queryOrderResportSerchModel')) || !orderReportService.validate($scope)) {
//			return;
//		}
		
		$scope.query = null;
		queryPagination(doParam());
	}
	// 点击订单查看订单详情
	$scope.showOrderlog = function($event,orderNo) {
		var obj=$($event.currentTarget);
		if(obj.next("tr").attr ("hidden")=="hidden"){
			obj.next("tr").attr("hidden",null);
		}else{
			obj.next("tr").attr("hidden","hidden");
		}
		if(obj.next("tr").next("tr").attr ("hidden")=="hidden"){
			obj.next("tr").next("tr").attr("hidden",null);
		}else{
			obj.next("tr").next("tr").attr("hidden","hidden");
		}
		if(obj.next("tr").next("tr").next("tr").attr ("hidden")=="hidden"){
			obj.next("tr").next("tr").next("tr").attr("hidden",null);
		}else{
			obj.next("tr").next("tr").next("tr").attr("hidden","hidden");
		}
	}
});
